The present invention relates to computer graphics, and more particularly to mapping of depth values during computer graphics processing.
Generally, bump and texture mapping are processes where basic contours of an object are expressed as a polygon in a modeling process and real world map data is used for a rendering process. During the course of bump and texture mapping, a color calculation is performed to incorporate colors onto an object in display coordinate space. This object with the colors is then displayed on a display device.
Prior Art FIG. 1 illustrates the method by which an exemplary bump mapping process is accomplished. As shown, a primitive, i.e. polygon, triangle, etc., is first received with pixel data, as shown in operation 100. Included with such pixel data are normal values and possibly other values associated with the vertices associated with the polygon. These vectors are perspectively and correctly interpolated across the primitive. At each pixel, texture coordinates (also interpolated) are used to look up bump mapping information.
During bump mapping, the aforementioned normal values are modified based on a bump map algorithm using the bump mapping information, as indicated in operation 102 of FIG. 1. In particular, the normal""s direction is perturbed as though the surface has been displaced a small amount in the direction of the interpolated normals of the primitive. FIG. 2 illustrates a primitive 200 with a normal 202 that is modified to generate a perturbed normal 204. A bumpy surface is thereby simulated.
Thereafter, lighting operations such as shading or the like are performed on the pixel data using the perturbed normal values instead of the original normal values, as indicated in operation 104. This method gives the appearance of bumps and depressions in the surface. Also at this time, the color calculation may be carried out in order to enhance the color of the pixel.
While the foregoing bump and texture mapping techniques feature the unevenness of a surface and enhance the color of a pixel, they do not work well to reflect any unevenness in shadows cast by or onto the bumpy surface. Further, there are also limitations as to the interaction of geometric objects. These drawbacks are mainly due to the fact that conventional bump and texture mapping processes have no impact on the z-value of the pixel.
There is thus a need for a texture/bump mapping scheme during graphic processing that overcomes these drawbacks for providing a more realistic rendered image.
A system, method and article of manufacture are provided for computer graphics processing. First, pixel data is received including a depth-value, i.e. z-value, w-value, etc. Thereafter, the depth-value is modified based on a depth-component of an algorithm. An operation is subsequently performed on the pixel data taking into account the modified depth-value.
In one embodiment of the present invention, the operation may include a lighting operation. It should be noted, however, that the operation may take any form such as a hidden surface calculation, shadow map operation, etc. As an option, the algorithm may include a bump map algorithm, or any other desired algorithm. Still yet, the algorithm may include a projection transformation of a bump mapping algorithm.
In another embodiment of the present invention, the pixel data may further include a normal value, wherein the normal value is also modified. The present invention thus allows more realistic rendering in those cases where accurate depth-values are important. In particular, Z-buffered intersections of Z-bumped triangles have rough intersections rather than the normal line of intersection. Another example of use of the present technique is in shadow calculations. Z-bumped triangles may cast and receive bumpy shadows in contrast with simple lines of shadow.
Another general utility of this technique is in the use of bump mapping as a proxy for geometry. The corrected depth-values improve the accuracy of the proxy without very significantly increasing the rendering cost.
The various embodiments permit the modification of the depth-value associated with each pixel. In use, the depth-value is modified based on some pre-projection amount. In one application, this depth-value modification may correspond to the displacement used to modify the normal for lighting purposes. The modified depth-value could also be used in conjunction with a shadow buffer algorithm to more accurately model shadows cast by, or cast onto a bump mapped primitive.